package cn.seaboot.admin.api.service;

import cn.seaboot.admin.api.bean.ApiParameter;
import cn.seaboot.admin.api.dao.ApiParameterDao;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * Service
 * 接口查询参数配置 [t_api_param]
 *
 * @author Mr.css on 2018-6-20
 */
@Service
public class ApiParameterService {

    @Resource
    private ApiParameterDao apiParamDao;

    /**
     * 增
     *
     * @param pojo pojo
     * @return affected rows
     */
    public int insert(ApiParameter pojo) {
        return apiParamDao.insert(pojo);
    }

    /**
     * 删
     *
     * @param id id
     * @return affected rows
     */
    public int deleteById(String id) {
        return apiParamDao.deleteById(id);
    }

    /**
     * 删
     *
     * @param projectId 工程ID
     * @return affected rows
     */
    public int deleteByProjectId(String projectId) {
        return apiParamDao.deleteByProjectId(projectId);
    }

    /**
     * 改
     *
     * @param pojo pojo
     * @return affected rows
     */
    public int updateById(ApiParameter pojo) {
        return apiParamDao.updateSampleById(pojo);
    }

    /**
     * 查
     *
     * @param id id
     * @return pojo
     */
    public ApiParameter queryById(String id) {
        return apiParamDao.selectById(id);
    }

    /**
     * 查列表
     *
     * @param params 参数
     * @return list
     */
    public List<ApiParameter> queryList(Map<String, Object> params) {
        return apiParamDao.selectList(params);
    }


    /**
     * 查列表
     *
     * @param projectId projectId
     * @param mappingId mappingId
     * @return listMap
     */
    public List<ApiParameter> queryMappingId(String projectId, String mappingId) {
        return apiParamDao.selectByMappingId(projectId, mappingId);
    }
}
